home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / btnc200 / util.c < prev   
C/C++ Source or Header  |  1993-01-29  |  1KB  |  68 lines

  1. /*
  2. **    Program:    BTNC
  3. **
  4. **    Module:        Utility functions
  5. */
  6.  
  7. #include        <portab.h>
  8. #include        <ctype.h>
  9. #include        <string.h>
  10.  
  11. #include        "general.h"
  12.  
  13. VOID CleanString(BYTE *source, BYTE *dest)
  14. {
  15.     while (*source)
  16.     {
  17.         if (!isspace(*source) &&
  18.             !(*source == '\n')) *dest++ = *source;
  19.         
  20.         source++;
  21.     }
  22.     
  23.     *++dest = EOS;
  24. }
  25.  
  26. VOID ReplaceUnderscores(BYTE *string)
  27. {
  28.     while (*string)
  29.     {
  30.         if (*string == '_') *string = ' ';
  31.         string++;
  32.     }
  33. }
  34.  
  35. BYTE *NextField(BYTE *start, BYTE *dest)
  36. {
  37.     BYTE    *runptr = start;
  38.     
  39.     while ((*runptr) && (*runptr != ',')) *dest++ = *runptr++;
  40.     *dest = EOS;
  41.     
  42.     if (!*runptr) 
  43.         return (NULL);
  44.     else
  45.         return(++runptr);
  46. }
  47.  
  48. VOID CodeSystemEntry (SYSTEM *sys, CSYSTEM *tmp)
  49. {
  50.     BYTE    *s = tmp->code;
  51.         
  52.     tmp->hubnode    = sys->hubnode;
  53.     tmp->maxbaud    = sys->maxbaud;
  54.     tmp->modemtype    = sys->modemtype;
  55.     tmp->flags        = sys->flags;
  56.     
  57.     strcpy (s, sys->sysname);
  58.     Last(s) = Last(s) | HB;
  59.     strcat (s, sys->location);
  60.     Last(s) = Last(s) | HB;
  61.     strcat (s, sys->operator);
  62.     Last(s) = Last(s) | HB;
  63.     strcat (s, sys->phone);
  64.     Last(s) = Last(s) | HB;
  65.     
  66.     tmp->length = 10 + (UWORD)strlen(s);
  67. }
  68.